import 'package:flutter/material.dart';
import 'package:palmf_hid/common/values/my_color.dart';
import 'package:get/get.dart';

PreferredSize myAppBar(
    {String? titleName,
    double? height,
    List<Widget>? action,
    Widget? title,
    Widget? leading,
    Widget? flexibleSpace,
    Color? backgroundColor,
    Color? titleColor,
    Color? leadColor,
    double? elevation,
    double? fontSize,
    bool centerTitle = true,
    PreferredSizeWidget? bottom}) {
  return PreferredSize(
      preferredSize: Size.fromHeight(height ?? 40.0),
      child: AppBar(
        backgroundColor: backgroundColor ?? MyColor.c_FFFFFFFF,
        flexibleSpace: flexibleSpace,
        title: title ??
            Text(
              titleName ?? "",
              style: TextStyle(
                  fontSize: fontSize ?? 18,
                  color: titleColor ?? Colors.black87),
            ),
        centerTitle: centerTitle,
        actions: action,
        leading: leading ??
            InkWell(
              child: Icon(Icons.arrow_back_ios_new_outlined,
                  size: 20, color: leadColor ?? Colors.black87),
              onTap: () {
                Get.back();
              },
            ),
        bottom: bottom,
        elevation: elevation ?? 0,
      ));
}
